# -*- coding: utf-8 -*-
import tkinter as tk
import tkinter.ttk as ttk


class UartSettingFrame(tk.Frame):
	def __init__(self, *args, **kwargs):
		super().__init__(*args, **kwargs)
		self.__set_identifier_frame()
		self.__set_device_frame()
		self.__set_baudrate_frame()
		self.__set_data_bits_Frame()
		self.__set_parity_Frame()
		self.__set_stop_bits_Frame()
		self.__set_flow_control_Frame()

	def __set_identifier_frame(self):
		_tmpFrame=tk.Frame(self)
		tk.Label(_tmpFrame, text='Identifier:',width=8,anchor='e').pack(side='left')
		tk.Label(_tmpFrame, text='UART1').pack(side='left')
		_tmpFrame.pack()

	def __set_device_frame(self):
		_tmpFrame=tk.Frame(self)
		tk.Label(_tmpFrame, text='Device:',width=8,anchor='e').pack(side='left')
		tk.Label(_tmpFrame, text='/dev/cu.usbserial-MLB2A').pack(side='left')
		_tmpFrame.pack()

	def __set_baudrate_frame(self):
		_tmpFrame=tk.Frame(self)
		tk.Label(_tmpFrame, text='Baudrate:',width=8,anchor='e').pack(side='left')
		ttk.Combobox(_tmpFrame, value=('115200','230400','460800','921600'),width=8).pack(side='left')
		_tmpFrame.pack()

	def __set_data_bits_Frame(self):
		_tmpFrame=tk.Frame(self)
		tk.Label(_tmpFrame, text='Data Bits:',width=8,anchor='e').pack(side='left')
		ttk.Combobox(_tmpFrame, value=('5','6','7','8'),width=8).pack(side='left')
		_tmpFrame.pack()

	def __set_parity_Frame(self):
		_tmpFrame=tk.Frame(self)
		tk.Label(_tmpFrame, text='Parity:',width=8,anchor='e').pack(side='left')
		ttk.Combobox(_tmpFrame, value=('None','odd','even'),width=8).pack(side='left')
		_tmpFrame.pack()

	def __set_stop_bits_Frame(self):
		_tmpFrame=tk.Frame(self)
		tk.Label(_tmpFrame, text='Stop Bits:',width=8,anchor='e').pack(side='left')
		ttk.Combobox(_tmpFrame, value=('1','1.5','2'),width=8).pack(side='left')
		_tmpFrame.pack()

	def __set_flow_control_Frame(self):
		_tmpFrame=tk.Frame(self)
		tk.Label(_tmpFrame, text='Stop Bits:',width=8,anchor='e').pack(side='left')
		_checkButtonFrame = tk.Frame(_tmpFrame)
		ttk.Checkbutton(_checkButtonFrame,text='CTS').pack()
		ttk.Checkbutton(_checkButtonFrame,text='DTR').pack()
		ttk.Checkbutton(_checkButtonFrame,text='XON').pack()
		_checkButtonFrame.pack(side='left')
		_tmpFrame.pack()




class GUIAPP(tk.Tk):
	def __init__(self,*args,**kwargs):
		super().__init__(*args, **kwargs)
		UartSettingFrame(self).pack()



	def __init_Logger(self):
		pass















if __name__ == '__main__':
	app=GUIAPP()
	app.mainloop()

